<div class="wrapper-bz-page">
    <div class="wrapper-bz-body">
        <div class="column-block block-left" style="width:290px;">
            <div class="column-title">单词</div>
            <div class="column-content">
                <div class="column-filter">
                    <div class="common-search-box">
                        <input style="width:120px"  id="search_input_lib_word_en_m59" />
                    </div>
                </div>
                <div class="column-datagrid">
                    <table id="table_lib_word_en_m59" style="width:100%;height:100%"></table>
                </div>
            </div>
        </div>
        <div class="column-block block-right" style="left:300px;">
            <div class="column-block block-up" style="height:300px;">
                <div class="column-block block-left" style="width:100px;">
                    <div class="column-title">单词词性</div>
                    <div class="column-content">
                        <div class="column-datagrid no-filter">
                            <table id="table_lib_word_en_type_m59" style="width:100%;height:100%"></table>
                        </div>
                    </div>
                </div>
                <div class="column-block block-left" style="left:110px; width:430px;">
                    <div class="column-title">单词释义</div>
                    <div class="column-content">
                        <div class="column-datagrid no-filter">
                            <table id="table_lib_word_en_meaning_m59" style="width:100%;height:100%"></table>
                        </div>
                    </div>
                </div>
                <div class="column-block block-right" style="left:550px;">
                    <div class="column-title">单词例句</div>
                    <div class="column-content">
                        <div class="column-datagrid no-filter">
                            <table id="table_lib_word_en_meaning_sentence_m59" style="width:100%;height:100%"></table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="column-block block-down" style="top:310px;">
                <div class="column-block block-left" style="width:540px;">
                    <div class="column-title">单词词组</div>
                    <div class="column-content">
                        <div class="column-datagrid no-filter">
                            <table id="table_lib_word_en_phrase_m59" style="width:100%;height:100%"></table>
                        </div>
                    </div>
                </div>
                <div class="column-block block-right" style="left:550px;">
                    <div class="column-title">词组例句</div>
                    <div class="column-content">
                        <div class="column-datagrid no-filter">
                            <table id="table_lib_word_en_phrase_sentence_m59" style="width:100%;height:100%"></table>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
<div id="dialog_add_lib_word_en_in_lib_word_en_m59"></div>
<div id="dialog_add_lib_word_en_meaning_in_lib_word_en_m59"></div>
<div id="dialog_edit_lib_word_en_meaning_in_lib_word_en_m59"></div>
<div id="dialog_add_lib_word_en_phrase_in_lib_word_en_m59"></div>
<div id="dialog_edit_lib_word_en_phrase_in_lib_word_en_m59"></div>
<div id="dialog_add_lib_word_en_sentence_in_lib_word_en_m59"></div>
<div id="dialog_edit_lib_word_en_sentence_in_lib_word_en_m59"></div>

<script>
    $(function(){
        var subject = "lib_word_en_m59";
        var tableId = "table_" + subject;
        var searchInputId = "search_input_" + subject;
        var tableObjectWord = $("#table_lib_word_en_m59");
        var tableObjectWordType = $("#table_lib_word_en_type_m59");
        var tableObjectWordMeaning = $("#table_lib_word_en_meaning_m59");
        var tableObjectWordMeaningSentence = $("#table_lib_word_en_meaning_sentence_m59");
        var tableObjectWordPhrase = $("#table_lib_word_en_phrase_m59");
        var tableObjectWordPhraseSentence = $("#table_lib_word_en_phrase_sentence_m59");

        var selectLeftMainId = 0;

        var dialogIdAddLibWordEn = '#dialog_add_lib_word_en_in_' + subject;
        var dialogObjAddLibWordEn = $(dialogIdAddLibWordEn);
        var formIdAddLibWordEn = '#form_add_lib_word_en';

        var dialogIdAddLibWordEnMeaning = '#dialog_add_lib_word_en_meaning_in_' + subject;
        var dialogIdEditLibWordEnMeaning = '#dialog_edit_lib_word_en_meaning_in_' + subject;
        var dialogObjAddLibWordEnMeaning = $(dialogIdAddLibWordEnMeaning);
        var dialogObjEditLibWordEnMeaning = $(dialogIdEditLibWordEnMeaning);

        var dialogIdAddLibWordEnPhrase = '#dialog_add_lib_word_en_phrase_in_' + subject;
        var dialogIdEditLibWordEnPhrase = '#dialog_edit_lib_word_en_phrase_in_' + subject;
        var dialogObjAddLibWordEnPhrase = $(dialogIdAddLibWordEnPhrase);
        var dialogObjEditLibWordEnPhrase = $(dialogIdEditLibWordEnPhrase);

        var dialogIdAddLibWordEnSentence = '#dialog_add_lib_word_en_sentence_in_' + subject;
        var dialogIdEditLibWordEnSentence = '#dialog_edit_lib_word_en_sentence_in_' + subject;
        var dialogObjAddLibWordEnSentence = $(dialogIdAddLibWordEnSentence);
        var dialogObjEditLibWordEnSentence = $(dialogIdEditLibWordEnSentence);


        var formIdAddLibWordEnMeaning = '#form_add_lib_word_en_meaning_in_m59';
        var formIdEditLibWordEnMeaning = '#form_edit_lib_word_en_meaning_in_m59';

        var formIdAddLibWordEnPhrase = '#form_add_lib_word_en_phrase_in_m59';
        var formIdEditLibWordEnPhrase = '#form_edit_lib_word_en_phrase_in_m59';

        var formIdAddLibWordEnSentence = '#form_add_lib_word_en_sentence_in_m59';
        var formIdEditLibWordEnSentence = '#form_edit_lib_word_en_sentence_in_m59';

        var configDialogAddLibWordEn = {
            href:'/admin/LibWordEn/pageAdd',
            title:'新增单词',
            queryParams:{},
            width:dialogDefaultWidth,
            height:350,
            modal:true,
            buttons:[
                {
                    text:'<span class="dialog-btn-ok"><i class="fa fa-check"></i>保存</span>',
                    plain:true,
                    handler:function(){
                        var paramDataAdd = $(formIdAddLibWordEn).serializeObject();
                        paramDataAdd.word_type = $("#word_type_in_form_add_lib_word_en").combobox('getValues');
                        var loading = layer.load(1, {
                            shade: [0.1,'#fff'] //0.1透明度的白色背景
                        });
                        $.ajax({
                            url: '/api/LibWordEn/addLibWordEn',
                            async: false,
                            dataType:'json',
                            type:'post',
                            data:paramDataAdd,
                            success:function(resp){
                                layer.close(loading);
                                if( 1 == resp.code ){
                                    dialogObjAddLibWordEn.dialog('close');
                                    tableObjectWord.datagrid('reload');
                                }else{
                                    layer.msg(resp.message);
                                }
                            }
                        });
                    }
                },{
                    text:'<span class="dialog-btn-cancel"><i class="fa fa-times"></i>取消</span>',
                    plain:true,
                    handler:function(){
                        dialogObjAddLibWordEn.dialog('close');
                    }
                }
            ]
        };

        var configDialogAddLibWordEnMeaning = {
            href:'/admin/LibWordEnMeaning/pageAdd',
            title:'新增单词释义',
            queryParams:{},
            width:dialogDefaultWidth,
            height:500,
            modal:true,
            buttons:[
                {
                    text:'<span class="dialog-btn-ok"><i class="fa fa-check"></i>保存</span>',
                    plain:true,
                    handler:function(){
                        var paramDataAdd = $(formIdAddLibWordEnMeaning).serializeObject();
                        paramDataAdd = $.extend({word_id:selectLeftMainId}, paramDataAdd);
                        console.log(paramDataAdd);
                        var loading = layer.load(1, {
                            shade: [0.1,'#fff'] //0.1透明度的白色背景
                        });
                        $.ajax({
                            url: '/api/LibWordEnMeaning/addLibWordEnMeaning',
                            async: false,
                            dataType:'json',
                            type:'post',
                            data:paramDataAdd,
                            success:function(resp){
                                layer.close(loading);
                                if( 1 == resp.code ){
                                    dialogObjAddLibWordEnMeaning.dialog('close');
                                    tableObjectWordMeaning.datagrid('reload');
                                }else{
                                    layer.msg(resp.message);
                                }
                            }
                        });
                    }
                },{
                    text:'<span class="dialog-btn-cancel"><i class="fa fa-times"></i>取消</span>',
                    plain:true,
                    handler:function(){
                        dialogObjAddLibWordEnMeaning.dialog('close');
                    }
                }
            ]
        };

        var configDialogEditLibWordEnMeaning = {
            href:'/admin/LibWordEnMeaning/pageEdit',
            title:'编辑单词释义',
            queryParams:{},
            width:dialogDefaultWidth,
            height:500,
            modal:true,
            buttons:[
                {
                    text:'<span class="dialog-btn-ok"><i class="fa fa-check"></i>保存</span>',
                    plain:true,
                    handler:function(){
                        var paramDataEdit = $(formIdEditLibWordEnMeaning).serializeObject();
                        console.log(paramDataEdit);
                        var loading = layer.load(1, {
                            shade: [0.1,'#fff'] //0.1透明度的白色背景
                        });
                        $.ajax({
                            url: '/api/LibWordEnMeaning/editLibWordEnMeaning',
                            async: false,
                            dataType:'json',
                            type:'post',
                            data:paramDataEdit,
                            success:function(resp){
                                layer.close(loading);
                                if( 1 == resp.code ){
                                    dialogObjEditLibWordEnMeaning.dialog('close');
                                    tableObjectWordMeaning.datagrid('reload');
                                }else{
                                    layer.msg(resp.message);
                                }
                            }
                        });
                    }
                },{
                    text:'<span class="dialog-btn-cancel"><i class="fa fa-times"></i>取消</span>',
                    plain:true,
                    handler:function(){
                        dialogObjEditLibWordEnMeaning.dialog('close');
                    }
                }
            ]
        };

        var configDialogAddLibWordEnPhrase = {
            href:'/admin/LibWordEnPhrase/pageAdd',
            title:'新增单词词组',
            queryParams:{},
            width:dialogDefaultWidth,
            height:500,
            modal:true,
            buttons:[
                {
                    text:'<span class="dialog-btn-ok"><i class="fa fa-check"></i>保存</span>',
                    plain:true,
                    handler:function(){
                        var paramDataAdd = $(formIdAddLibWordEnPhrase).serializeObject();
                        paramDataAdd = $.extend({'word_id': selectLeftMainId}, paramDataAdd);
                        console.log(paramDataAdd);
                        var loading = layer.load(1, {
                            shade: [0.1,'#fff'] //0.1透明度的白色背景
                        });
                        $.ajax({
                            url: '/api/LibWordEnPhrase/addLibWordEnPhrase',
                            async: false,
                            dataType:'json',
                            type:'post',
                            data:paramDataAdd,
                            success:function(resp){
                                layer.close(loading);
                                if( 1 == resp.code ){
                                    dialogObjAddLibWordEnPhrase.dialog('close');
                                    tableObjectWordPhrase.datagrid('reload');
                                }else{
                                    layer.msg(resp.message);
                                }
                            }
                        });
                    }
                },{
                    text:'<span class="dialog-btn-cancel"><i class="fa fa-times"></i>取消</span>',
                    plain:true,
                    handler:function(){
                        dialogObjAddLibWordEnPhrase.dialog('close');
                    }
                }
            ]
        };

        var configDialogEditLibWordEnPhrase = {
            href:'/admin/LibWordEnPhrase/pageEdit',
            title:'编辑单词词组',
            queryParams:{},
            width:dialogDefaultWidth,
            height:500,
            modal:true,
            buttons:[
                {
                    text:'<span class="dialog-btn-ok"><i class="fa fa-check"></i>保存</span>',
                    plain:true,
                    handler:function(){
                        var paramDataEdit = $(formIdEditLibWordEnPhrase).serializeObject();
                        console.log(paramDataEdit);
                        var loading = layer.load(1, {
                            shade: [0.1,'#fff'] //0.1透明度的白色背景
                        });
                        $.ajax({
                            url: '/api/LibWordEnPhrase/editLibWordEnPhrase',
                            async: false,
                            dataType:'json',
                            type:'post',
                            data:paramDataEdit,
                            success:function(resp){
                                layer.close(loading);
                                if( 1 == resp.code ){
                                    dialogObjEditLibWordEnPhrase.dialog('close');
                                    tableObjectWordPhrase.datagrid('reload');
                                }else{
                                    layer.msg(resp.message);
                                }
                            }
                        });
                    }
                },{
                    text:'<span class="dialog-btn-cancel"><i class="fa fa-times"></i>取消</span>',
                    plain:true,
                    handler:function(){
                        dialogObjEditLibWordEnPhrase.dialog('close');
                    }
                }
            ]
        };

        var configDialogAddLibWordEnSentence = {
            href:'/admin/LibWordEnSentence/pageAdd',
            title:'新增单词例句',
            queryParams:{},
            width:dialogDefaultWidth,
            height:500,
            modal:true,
            buttons:[
                {
                    text:'<span class="dialog-btn-ok"><i class="fa fa-check"></i>保存</span>',
                    plain:true,
                    handler:function(){
                        var paramDataAdd = $(formIdAddLibWordEnSentence).serializeObject();
                        console.log(paramDataAdd);
                        var loading = layer.load(1, {
                            shade: [0.1,'#fff'] //0.1透明度的白色背景
                        });
                        $.ajax({
                            url: '/api/LibWordEnSentence/addLibWordEnSentence',
                            async: false,
                            dataType:'json',
                            type:'post',
                            data:paramDataAdd,
                            success:function(resp){
                                layer.close(loading);
                                if( 1 == resp.code ){
                                    dialogObjAddLibWordEnSentence.dialog('close');
                                    tableObjectWordSentence.datagrid('reload');
                                }else{
                                    layer.msg(resp.message);
                                }
                            }
                        });
                    }
                },{
                    text:'<span class="dialog-btn-cancel"><i class="fa fa-times"></i>取消</span>',
                    plain:true,
                    handler:function(){
                        dialogObjAddLibWordEnSentence.dialog('close');
                    }
                }
            ]
        };

        var configDialogEditLibWordEnSentence = {
            href:'/admin/LibWordEnSentence/pageEdit',
            title:'编辑单词例句',
            queryParams:{},
            width:dialogDefaultWidth,
            height:500,
            modal:true,
            buttons:[
                {
                    text:'<span class="dialog-btn-ok"><i class="fa fa-check"></i>保存</span>',
                    plain:true,
                    handler:function(){
                        var paramDataEdit = $(formIdEditLibWordEnSentence).serializeObject();
                        console.log(paramDataEdit);
                        var loading = layer.load(1, {
                            shade: [0.1,'#fff'] //0.1透明度的白色背景
                        });
                        $.ajax({
                            url: '/api/LibWordEnSentence/editLibWordEnSentence',
                            async: false,
                            dataType:'json',
                            type:'post',
                            data:paramDataEdit,
                            success:function(resp){
                                layer.close(loading);
                                if( 1 == resp.code ){
                                    dialogObjEditLibWordEnSentence.dialog('close');
                                    tableObjectWordSentence.datagrid('reload');
                                }else{
                                    layer.msg(resp.message);
                                }
                            }
                        });
                    }
                },{
                    text:'<span class="dialog-btn-cancel"><i class="fa fa-times"></i>取消</span>',
                    plain:true,
                    handler:function(){
                        dialogObjEditLibWordEnSentence.dialog('close');
                    }
                }
            ]
        };

        var configDatagridWord = {
            url:'/api/LibWordEn/getLibWordEnOption',
            method: 'post',
            remoteSort:false,
            pageList:[20,50,100],
            pageSize:20,
            pagination:false,
            queryParams: {status:1},
            clickToEdit:false,
            dblclickToEdit:true,
            singleSelect:true,
            rownumbers:false,
            striped:true,
            fitColumns:true,
            fit:true,
            frozenColumns:[[
            ]],
            columns:[[
                {field:'id',title:'ID',width:40,hidden:true},
                {field:'spelling',title:'单词', width:100},
            ]],
            loadFilter: function(data){
                return loadFilter(data, false);
            },
            onSelect: function(index, row){
                configDatagridWordType.queryParams = {word_id:row.id};
                configDatagridWordPhrase.queryParams = {word_id:row.id};
                tableObjectWordType.datagrid(configDatagridWordType);
                tableObjectWordPhrase.datagrid(configDatagridWordPhrase);

                selectLeftMainId = row.id;
            },
            onClickRow: function(index, row){
            },
            onLoadSuccess: function(){
                tableObjectWord.datagrid('selectRow', 0);
            },
            toolbar:[
                {
                    text:'<span class="tool-btn-refresh"><i class="fa fa-refresh"></i>刷新</span>',
                    plain:true,
                    handler:function(){
                        tableObjectWord.datagrid('reload');
                    }
                },
                {
                    text:'<span class="tool-btn-add"><i class="fa fa-plus"></i>新增</span>',
                    plain:true,
                    handler:function(){
                        dialogObjAddLibWordEn.dialog(configDialogAddLibWordEn);
                    }
                }
            ]
        };

        var configDatagridWordType = {
            url:'/api/LibWordEnType/getLibWordEnTypeOption',
            method: 'post',
            remoteSort:false,
            pageList:[20,50,100],
            pageSize:20,
            pagination:false,
            queryParams: {status:1},
            clickToEdit:false,
            dblclickToEdit:true,
            singleSelect:true,
            rownumbers:false,
            striped:true,
            fitColumns:true,
            fit:true,
            frozenColumns:[[
            ]],
            columns:[[
                {field:'id',title:'ID',width:40,hidden:true},
                {field:'speech_text',title:'词性', width:80},
            ]],
            onSelect: function(index, row){
                configDatagridWordMeaning.queryParams = {word_type_id:row.id};
                tableObjectWordMeaning.datagrid(configDatagridWordMeaning);
            },
            loadFilter: function(data){
                return loadFilter(data, false);
            },
            onClickRow: function(index, row){
            },
            onLoadSuccess: function(){
                tableObjectWordType.datagrid('selectRow', 0);
            },
            toolbar:[
                {
                    text:'<span class="tool-btn-refresh"><i class="fa fa-refresh"></i>刷新</span>',
                    plain:true,
                    handler:function(){
                    }
                }
            ]
        };

        var configDatagridWordMeaning = {
            url:'/api/LibWordEnMeaning/getLibWordEnMeaningOption',
            method: 'post',
            remoteSort:false,
            pageList:[20,50,100],
            pageSize:20,
            pagination:false,
            queryParams: {status:1},
            clickToEdit:false,
            dblclickToEdit:true,
            singleSelect:true,
            rownumbers:false,
            striped:true,
            fitColumns:true,
            fit:true,
            frozenColumns:[[
            ]],
            columns:[[
                {field:'id',title:'ID',width:40,hidden:true},
                {field:'meaning_en',title:'释义',width:300, formatter: function (value, row, index) {
                        return '<div>' + value + '</div><div style="font-size:12px;">' + row.meaning_cn + '</div>';
                }},
            ]],
            loadFilter: function(data){
                return loadFilter(data, false);
            },
            onSelect: function(index, row){
                configDatagridWordMeaningSentence.queryParams = {word_meaning_id:row.id};
                tableObjectWordMeaningSentence.datagrid(configDatagridWordMeaningSentence);
            },
            onClickRow: function(index, row){
            },
            onLoadSuccess: function(){
                tableObjectWordMeaning.datagrid('selectRow', 0);
            },
            toolbar:[
                {
                    text:'<span class="tool-btn-refresh"><i class="fa fa-refresh"></i>刷新</span>',
                    plain:true,
                    handler:function(){
                    }
                },
                {
                    text:'<span class="tool-btn-add"><i class="fa fa-plus"></i>新增</span>',
                    plain:true,
                    handler:function(){
                        dialogObjAddLibWordEnMeaning.dialog(configDialogAddLibWordEnMeaning);
                    }
                },
                {
                    text:'<span class="tool-btn-edit"><i class="fa fa-edit"></i>编辑</span>',
                    plain:true,
                    handler:function(){
                        var libWordEnMeaningInfo = tableObjectWordMeaning.datagrid("getSelected");
                        configDialogEditLibWordEnMeaning.queryParams = {id:libWordEnMeaningInfo['id']};
                        dialogObjEditLibWordEnMeaning.dialog(configDialogEditLibWordEnMeaning);
                    }
                },
                {
                    text:'<span class="tool-btn-delete"><i class="fa fa-delete"></i>删除</span>',
                    plain:true,
                    handler:function(){
                        var libWordEnMeaningInfo = tableObjectWordMeaning.datagrid("getSelected");
                        var confirm = layer.confirm('你确定要删除?',{title:'执行操作',btn:['是','否']},function(){
                            $.ajax({
                                url:'/api/LibWordEnMeaning/deleteLibWordEnMeaning',
                                type:'post',
                                data: {id: libWordEnMeaningInfo['id']},
                                dataType:'json',
                                success:function(resp){
                                    layer.close(confirm);
                                    if(1 == resp.code){
                                        tableObjectWordMeaning.datagrid('reload');
                                    }else{
                                        layer.msg(resp.message);
                                    }
                                }
                            });
                        });
                    }
                }
            ]
        };

        var configDatagridWordMeaningSentence = {
            url:'/api/LibWordEnSentence/getLibWordEnSentenceOption',
            method: 'post',
            remoteSort:false,
            pageList:[20,50,100],
            pageSize:20,
            pagination:false,
            queryParams: {status:1},
            clickToEdit:false,
            dblclickToEdit:true,
            singleSelect:true,
            rownumbers:false,
            striped:true,
            fitColumns:true,
            fit:true,
            frozenColumns:[[
            ]],
            columns:[[
                {field:'id',title:'ID',width:40,hidden:true},
                {field:'sentence_en',title:'例句',width:300},
            ]],
            loadFilter: function(data){
                return loadFilter(data, false);
            },
            onClickRow: function(index, row){

            },
            toolbar:[
                {
                    text:'<i class="fa fa-refresh tool-button-refresh"></i> 刷新',
                    id:'btn_refresh_in_page_toolbar',
                    plain:true,
                    handler:function(){
                    }
                },{
                    text:'<span class="tool-btn-add"><i class="fa fa-plus"></i>新增</span>',
                    plain:true,
                    handler:function(){
                        dialogObjAddLibWordEnSentence.dialog(configDialogAddLibWordEnSentence);
                    }
                },
                {
                    text:'<span class="tool-btn-edit"><i class="fa fa-edit"></i>编辑</span>',
                    plain:true,
                    handler:function(){
                        var meaningSentenceInfo = tableObjectWordMeaningSentence.datagrid("getSelected");
                        configDialogEditLibWordEnSentence.queryParams = {id:meaningSentenceInfo['id']};
                        dialogObjAddLibWordEnSentence.dialog(configDialogEditLibWordEnSentence);
                    }
                },
                {
                    text:'<span class="tool-btn-delete"><i class="fa fa-delete"></i>删除</span>',
                    plain:true,
                    handler:function(){
                        var meaningSentenceInfo = tableObjectWordMeaningSentence.datagrid("getSelected");
                        var confirm = layer.confirm('你确定要删除?',{title:'执行操作',btn:['是','否']},function(){
                            $.ajax({
                                url:'LibWordEnSentence/deleteLibWordEnSentence',
                                type:'post',
                                data: {id: meaningSentenceInfo['id']},
                                dataType:'json',
                                success:function(resp){
                                    layer.close(confirm);
                                    if(1 == resp.code){
                                        tableObjectWordMeaningSentence.datagrid('reload');
                                    }else{
                                        layer.msg(resp.message);
                                    }
                                }
                            });
                        });
                    }
                }
            ]
        };

        var configDatagridWordPhrase = {
            url:'/api/LibWordEnPhrase/getLibWordEnPhraseOption',
            method: 'post',
            remoteSort:false,
            pageList:[20,50,100],
            pageSize:20,
            pagination:false,
            queryParams: {status:1},
            clickToEdit:false,
            dblclickToEdit:true,
            singleSelect:true,
            rownumbers:false,
            striped:true,
            fit:true,
            frozenColumns:[[
                {field:'id',title:'ID',width:40,hidden:true},
                {field:'phrase',title:'词组',width:200},
            ]],
            columns:[[
                {field:'meaning_cn',title:'释义',width:500}
            ]],
            loadFilter: function(data){
                return loadFilter(data, false);
            },
            onSelect: function(index, row){
                configDatagridWordPhraseSentence.queryParams = {word_phrase_id:row.id};
                tableObjectWordPhraseSentence.datagrid(configDatagridWordPhraseSentence);
            },
            onClickRow: function(index, row){

            },
            onLoadSuccess: function(){
                tableObjectWordPhrase.datagrid('selectRow', 0);
            },
            toolbar:[
                {
                    text:'<i class="fa fa-refresh tool-btn-refresh"></i> 刷新',
                    id:'btn_refresh_in_page_toolbar',
                    plain:true,
                    handler:function(){
                    }
                },
                {
                    text:'<span class="tool-btn-add"><i class="fa fa-plus"></i>新增</span>',
                    plain:true,
                    handler:function(){
                        dialogObjAddLibWordEnPhrase.dialog(configDialogAddLibWordEnPhrase);
                    }
                },
                {
                    text:'<span class="tool-btn-edit"><i class="fa fa-edit"></i>编辑</span>',
                    plain:true,
                    handler:function(){
                        var libWordEnPhraseInfo = tableObjectWordPhrase.datagrid("getSelected");
                        configDialogEditLibWordEnPhrase.queryParams = {id:libWordEnPhraseInfo['id']};
                        dialogObjEditLibWordEnPhrase.dialog(configDialogEditLibWordEnPhrase);
                    }
                },
                {
                    text:'<span class="tool-btn-delete"><i class="fa fa-delete"></i>删除</span>',
                    plain:true,
                    handler:function(){
                        var libWordEnPhraseInfo = tableObjectWordPhrase.datagrid("getSelected");
                        var confirm = layer.confirm('你确定要删除?',{title:'执行操作',btn:['是','否']},function(){
                            $.ajax({
                                url:'/api/LibWordEnPhrase/deleteLibWordEnPhrase',
                                type:'post',
                                data: {"id": libWordEnPhraseInfo['id']},
                                dataType:'json',
                                success:function(resp){
                                    layer.close(confirm);
                                    if(1 == resp.code){
                                        tableObjectWordPhrase.datagrid('reload');
                                    }else{
                                        layer.msg(resp.message);
                                    }
                                }
                            });
                        });
                    }
                }
            ]
        };

        var configDatagridWordPhraseSentence = {
            url:'/api/LibWordEnSentence/getLibWordEnSentenceOption',
            method: 'post',
            remoteSort:false,
            pageList:[20,50,100],
            pageSize:20,
            pagination:false,
            queryParams: {status:1},
            clickToEdit:false,
            dblclickToEdit:true,
            singleSelect:true,
            rownumbers:false,
            striped:true,
            fitColumns:true,
            fit:true,
            frozenColumns:[[
            ]],
            columns:[[
                {field:'id',title:'ID',width:40,hidden:true},
                {field:'spelling',title:'单词',width:300},
                {field:'status',title:'状态',width:100}
            ]],
            loadFilter: function(data){
                return loadFilter(data, false);
            },
            onClickRow: function(index, row){

            },
            toolbar:[
                {
                    text:'<i class="fa fa-refresh tool-button-refresh"></i> 刷新',
                    id:'btn_refresh_in_page_toolbar',
                    plain:true,
                    handler:function(){
                    }
                },{
                    text:'<span class="tool-btn-add"><i class="fa fa-plus"></i>新增</span>',
                    plain:true,
                    handler:function(){
                        dialogObjAddLibWordEnSentence.dialog(configDialogAddLibWordEnSentence);
                    }
                },
                {
                    text:'<span class="tool-btn-edit"><i class="fa fa-edit"></i>编辑</span>',
                    plain:true,
                    handler:function(){
                        var meaningSentenceInfo = tableObjectWordPhraseSentence.datagrid("getSelected");
                        configDialogEditLibWordEnSentence.queryParams = {id:meaningSentenceInfo['id']};
                        dialogObjAddLibWordEnSentence.dialog(configDialogEditLibWordEnSentence);
                    }
                },
                {
                    text:'<span class="tool-btn-delete"><i class="fa fa-delete"></i>删除</span>',
                    plain:true,
                    handler:function(){
                        var phraseSentenceInfo = tableObjectWordPhraseSentence.datagrid("getSelected");
                        var confirm = layer.confirm('你确定要删除?',{title:'执行操作',btn:['是','否']},function(){
                            $.ajax({
                                url:'LibWordEnSentence/deleteLibWordEnSentence',
                                type:'post',
                                data: {id: phraseSentenceInfo['id']},
                                dataType:'json',
                                success:function(resp){
                                    layer.close(confirm);
                                    if(1 == resp.code){
                                        tableObjectWordPhraseSentence.datagrid('reload');
                                    }else{
                                        layer.msg(resp.message);
                                    }
                                }
                            });
                        });
                    }
                }
            ]
        };


        tableObjectWord.datagrid(configDatagridWord);
        // var searchFieldSelect = ['year', 'month'];
        // initComboboxOption(subject, searchFieldSelect);
        SearchCombobox(searchInputId, tableId,function (val,name) {
            configDatagridWord.queryParams[name] = val;
            tableObjectWord.datagrid(configDatagridWord);
        },['CK','ID', '状态']);

        function initSearchOption(searchOption)
        {
            $("#ele_select_activity_id_in_"+subject).combobox(searchOption.activity_id);
            $("#ele_select_activity_group_id_in_"+subject).combobox(searchOption.activity_group_id);
        }

    });
</script>